package com.example.wanglong.myoneapplication.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.example.wanglong.myoneapplication.entity.VisaDetailEntity;
import com.example.wanglong.myoneapplication.R;

import java.util.List;

/**
 * Created by wang.long on 2016/4/6.
 */
public class VisaDetailAdapter extends ArrayAdapter<VisaDetailEntity> {

    private int vid;

    public VisaDetailAdapter(Context context,int textViewVid,List<VisaDetailEntity> objects){
        super(context,textViewVid,objects);
        vid=textViewVid;

    }

    @Override
    public View getView(int position,View convertView,ViewGroup parent){
        VisaDetailEntity visa=getItem(position);
        View view= LayoutInflater.from(getContext()).inflate(vid, null);

        TextView title=(TextView) view.findViewById(R.id.title);
        TextView content=(TextView) view.findViewById(R.id.content);
        TextView tags=(TextView) view.findViewById(R.id.tags);
        TextView thesub=(TextView) view.findViewById(R.id.thesub);
        TextView price=(TextView) view.findViewById(R.id.price);

        title.setText(visa.getTitle());
        content.setText(visa.getContent());
        tags.setText(visa.getTags());
        thesub.setText(visa.getThesub());
        String price1 = String.valueOf(visa.getPrice());
        price.setText(price1);

        return view;

    }

}
